package com.tarry.set;

import java.util.TreeSet;

/**
 * TreeSet 排序
 */
public class TreeSetTest {
    public static void main(String[] args) {
        TreeSet<Student> ts=new TreeSet<>();
        //创建元素对象
        Student s1= new Student("zhangsan",20);
        Student s2=new Student("lis",22);
        Student s3=new Student("wangwu",24);
        Student s4=new Student("chenliu",26);
        Student s5=new Student("jack",22);
        Student s6=new Student("qianqi",24);
        //将元素对象添加到集合对象中
        ts.add(s1);
        ts.add(s2);
        ts.add(s3);
        ts.add(s4);
        ts.add(s5);
        ts.add(s6);

        ts.stream().forEach(System.out::println);
    }
}
